<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8" />
<title>transform</title>
<meta name="description" content="CSS3参考手册之: transform" />
<meta name="keywords" content="transform, css3, css3参考手册" />
<meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" />
<meta name="robots" content="all" />
<!--[if lte IE 8]>
<script src="../../js/html5.js"></script>
<![endif]-->
<link rel="stylesheet" href="../../skin/article.css" />
</head>
<body>
<nav id="guide" class="g-mod">
	<div class="from">
		<a href="http://css.doyoe.com/" target="_blank">CSS3参考手册</a>
		<span>&#187;</span>
		<a href="../index.htm">属性列表</a>
		<span>&#187;</span>
		<a href="index.htm" id="category" rel="properties/transform" name="transform">变换属性</a>
		<span>&#187;</span>
	</div>
	<div class="to">
		<span class="label">相关内容：</span>
		<div class="g-combobox g-transition">
			<a href="?" class="g-transition target">
				<strong>其它变换属性参考</strong>
				<span>选择其它项<!--[if lte IE 7]><ins>IE7 and earlier, Get to die</ins><![endif]--></span>
			</a>
			<div class="g-transition list">
				<ul>
					<!-- 插入快速分类导航 -->
				</ul>
			</div>
		</div>
	</div>
</nav>
<header id="hd">
	<section id="title" class="g-mod">
		<h1 class="tit">transform</h1>
		<ul class="info">
			<li><strong>版本：CSS3</strong></li>
			<li>2015.8.11</li>
		</ul>
		<!-- 插入浏览器信息 -->
	</section>
</header>
<section id="bd">
	<section id="syntax" class="g-mod g-attr">
		<h2 class="tit">语法：</h2>
		<div class="cont">
			<p><strong>transform</strong>：none | <a href="#transform-function">&lt;transform-function&gt;</a>+</p>
			<h3 id="transform-function">transform-function list:</h3>
			<p id="matrix"><strong>matrix()</strong> = matrix(<a href="../../values/numeric/number.htm">&lt;number&gt;</a>[,<a href="../../values/numeric/number.htm">&lt;number&gt;</a>]{5,5})</p>
			<p id="matrix3d"><strong>matrix3d()</strong> = matrix3d(<a href="../../values/numeric/number.htm">&lt;number&gt;</a>[,<a href="../../values/numeric/number.htm">&lt;number&gt;</a>]{15,15})</p>
			<p id="translate"><strong>translate()</strong> = translate(<a href="#translation-value">&lt;translation-value&gt;</a>[,<a href="#translation-value">&lt;translation-value&gt;</a>]?)</p>
			<p id="translate3d"><strong>translate3d()</strong> = translate3d(<a href="#translation-value">&lt;translation-value&gt;</a>,<a href="#translation-value">&lt;translation-value&gt;</a>,<a href="../../values/length/index.htm">&lt;length&gt;</a>)</p>
			<p id="translatex"><strong>translatex()</strong> = translatex(<a href="#translation-value">&lt;translation-value&gt;</a>)</p>
			<p id="translatey"><strong>translatey()</strong> = translatey(<a href="#translation-value">&lt;translation-value&gt;</a>)</p>
			<p id="translatez"><strong>translatez()</strong> = translatez(<a href="../../values/length/index.htm">&lt;length&gt;</a>)</p>
			<p id="rotate"><strong>rotate()</strong> = rotate(<a href="../../values/angle/index.htm">&lt;angle&gt;</a>)</p>
			<p id="rotate3d"><strong>rotate3d()</strong> = rotate3d(<a href="../../values/numeric/number.htm">&lt;number&gt;</a>,<a href="../../values/numeric/number.htm">&lt;number&gt;</a>,<a href="../../values/numeric/number.htm">&lt;number&gt;</a>,<a href="../../values/angle/index.htm">&lt;angle&gt;</a>)</p>
			<p id="rotatex"><strong>rotatex()</strong> = rotatex(<a href="../../values/angle/index.htm">&lt;angle&gt;</a>)</p>
			<p id="rotatey"><strong>rotatey()</strong> = rotatey(<a href="../../values/angle/index.htm">&lt;angle&gt;</a>)</p>
			<p id="rotatez"><strong>rotatez()</strong> = rotatez(<a href="../../values/angle/index.htm">&lt;angle&gt;</a>)</p>
			<p id="scale"><strong>scale()</strong> = scale(<a href="../../values/numeric/number.htm">&lt;number&gt;</a>[,<a href="../../values/numeric/number.htm">&lt;number&gt;</a>]?)</p>
			<p id="scale3d"><strong>scale3d()</strong> = scale3d(<a href="../../values/numeric/number.htm">&lt;number&gt;</a>,<a href="../../values/numeric/number.htm">&lt;number&gt;</a>,<a href="../../values/numeric/number.htm">&lt;number&gt;</a>)</p>
			<p id="scalex"><strong>scalex()</strong> = scalex(<a href="../../values/numeric/number.htm">&lt;number&gt;</a>)</p>
			<p id="scaley"><strong>scaley()</strong> = scaley(<a href="../../values/numeric/number.htm">&lt;number&gt;</a>)</p>
			<p id="scalez"><strong>scalez()</strong> = scalez(<a href="../../values/numeric/number.htm">&lt;number&gt;</a>)</p>
			<p id="skew"><strong>skew()</strong> = skew(<a href="../../values/angle/index.htm">&lt;angle&gt;</a>[,<a href="../../values/angle/index.htm">&lt;angle&gt;</a>]?)</p>
			<p id="skewx"><strong>skewx()</strong> = skewx(<a href="../../values/angle/index.htm">&lt;angle&gt;</a>)</p>
			<p id="skewy"><strong>skewy()</strong> = skewy(<a href="../../values/angle/index.htm">&lt;angle&gt;</a>)</p>
			<p id="perspective"><strong>perspective()</strong> = perspective(<a href="../../values/length/index.htm">&lt;length&gt;</a>)</p>
			<p id="translation-value"><strong>&lt;translation-value&gt;</strong> = <a href="../../values/length/index.htm">&lt;length&gt;</a> | <a href="../../values/numeric/percentage.htm">&lt;percentage&gt;</a></p>
			<p><strong>默认值</strong>：<mark class="defaultvalue">none</mark></p>
			<p><strong>适用于</strong>：所有块级元素及某些内联元素</p>
			<p><strong>继承性</strong>：无</p>
			<p><strong>动画性</strong>：是</p>
			<p><strong>计算值</strong>：指定值，但相对长度会转换为绝对长度</p>
			<p><strong>媒体</strong>：视觉</p>
		</div>
	</section>
	<section id="value" class="g-mod g-attr">
		<h2 class="tit">取值：</h2>
		<div class="cont">
			<dl>
				<dt>none：</dt>
				<dd>无转换</dd>
			</dl>
			<h3 class="g-color-light">2D Transform Functions：</h3>
			<dl>
				<dt><a href="#matrix">matrix()</a>：</dt>
				<dd>以一个含六值的(a,b,c,d,e,f)变换矩阵的形式指定一个2D变换，相当于直接应用一个[a,b,c,d,e,f]变换矩阵</dd>
				<dt><a href="#translate">translate()</a>：</dt>
				<dd>指定对象的2D translation（2D平移）。第一个参数对应X轴，第二个参数对应Y轴。如果第二个参数未提供，则默认值为0</dd>
				<dt><a href="#translatex">translatex()</a>：</dt>
				<dd>指定对象X轴（水平方向）的平移</dd>
				<dt><a href="#translatey">translatey()</a>：</dt>
				<dd>指定对象Y轴（垂直方向）的平移</dd>
				<dt><a href="#rotate">rotate()</a>：</dt>
				<dd>指定对象的2D rotation（2D旋转），需先有 &lt;' <a href="transform-origin.htm">transform-origin</a> '&gt; 属性的定义</dd>
				<dt><a href="#scale">scale()</a>：</dt>
				<dd>指定对象的2D scale（2D缩放）。第一个参数对应X轴，第二个参数对应Y轴。如果第二个参数未提供，则默认取第一个参数的值</dd>
				<dt><a href="#scalex">scalex()</a>：</dt>
				<dd>指定对象X轴的（水平方向）缩放</dd>
				<dt><a href="#scaley">scaley()</a>：</dt>
				<dd>指定对象Y轴的（垂直方向）缩放</dd>
				<dt><a href="#skew">skew()</a>：</dt>
				<dd>指定对象skew transformation（斜切扭曲）。第一个参数对应X轴，第二个参数对应Y轴。如果第二个参数未提供，则默认值为0</dd>
				<dt><a href="#skewx">skewx()</a>：</dt>
				<dd>指定对象X轴的（水平方向）扭曲</dd>
				<dt><a href="#skewy">skewy()</a>：</dt>
				<dd>指定对象Y轴的（垂直方向）扭曲</dd>
			</dl>
			<h3 class="g-color-light">3D Transform Functions：</h3>
			<dl>
				<dt><a href="#matrix3d">matrix3d()</a>：</dt>
				<dd>以一个4x4矩阵的形式指定一个3D变换</dd>
				<dt><a href="#translate3d">translate3d()</a>：</dt>
				<dd>指定对象的3D位移。第1个参数对应X轴，第2个参数对应Y轴，第3个参数对应Z轴，参数不允许省略</dd>
				<dt><a href="#translatez">translatez()</a>：</dt>
				<dd>指定对象Z轴的平移</dd>
				<dt><a href="#rotate3d">rotate3d()</a>：</dt>
				<dd>指定对象的3D旋转角度，其中前3个参数分别表示旋转的方向x,y,z，第4个参数表示旋转的角度，参数不允许省略</dd>
				<dt><a href="#rotatex">rotatex()</a>：</dt>
				<dd>指定对象在x轴上的旋转角度</dd>
				<dt><a href="#rotatey">rotatey()</a>：</dt>
				<dd>指定对象在y轴上的旋转角度</dd>
				<dt><a href="#rotatey">rotatez()</a>：</dt>
				<dd>指定对象在z轴上的旋转角度</dd>
				<dt><a href="#scale3d">scale3d()</a>：</dt>
				<dd>指定对象的3D缩放。第1个参数对应X轴，第2个参数对应Y轴，第3个参数对应Z轴，参数不允许省略</dd>
				<dt><a href="#scalez">scalez()</a>：</dt>
				<dd>指定对象的z轴缩放</dd>
				<dt><a href="#perspective">perspective()</a>：</dt>
				<dd>指定透视距离</dd>
			</dl>
		</div>
	</section>
	<section id="intro" class="g-mod g-attr">
		<h2 class="tit">说明：</h2>
		<div class="cont">
			<strong>设置或检索对象的转换。</strong>
			<ul>
				<li>对应的脚本特性为<strong>transform</strong>。</li>
			</ul>
		</div>
	</section>
	<section id="compatible" class="g-mod g-attr">
		<h2 class="tit">兼容性：</h2>
		<div class="cont">
			<ul class="support-type">
				<li><span class="support">浅绿</span> = 支持</li>
				<li><span class="unsupport">红色</span> = 不支持</li>
				<li><span class="partsupport">粉色</span> = 部分支持</li>
			</ul>
			<table class="g-data">
				<thead>
					<tr>
						<th>Values</th>
						<th>IE</th>
						<th>Firefox</th>
						<th>Chrome</th>
						<th>Safari</th>
						<th>Opera</th>
						<th>iOS Safari</th>
						<th>Android Browser</th>
						<th>Android Chrome</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td rowspan="3"><strong>Basic Support</strong></td>
						<td class="unsupport">6.0-8.0</td>
						<td class="unsupport">2.0-3.0</td>
						<td class="support">4.0-35.0<sup class="fix">-webkit-</sup></td>
						<td class="support">6.0-8.0<sup class="fix">-webkit-</sup></td>
						<td class="support">15.0-22.0<sup class="fix">-webkit-</sup></td>
						<td class="support">6.0-8.4<sup class="fix">-webkit-</sup></td>
						<td class="support">2.1-4.4.4<sup class="fix">-webkit-</sup></td>
						<td class="support">18.0-34.0<sup class="fix">-webkit-</sup></td>
					</tr>
					<tr>
						<td class="support">9.0<sup class="fix">-ms-</sup></td>
						<td class="support">3.5-15.0<sup class="fix">-moz-</sup></td>
						<td class="support" rowspan="2">36.0+</td>
						<td class="support" rowspan="2">9.0+</td>
						<td class="support" rowspan="2">23.0+</td>
						<td class="support" rowspan="2">9.0+</td>
						<td class="support" rowspan="2">40.0+</td>
						<td class="support" rowspan="2">35.0+</td>
					</tr>
					<tr>
						<td class="support">10.0+</td>
						<td class="support">16.0+</td>
					</tr>
				</tbody>
			</table>
		</div>
	</section>
	<section id="example" class="g-mod g-attr">
		<h2 class="tit">示例：</h2>
		<div class="cont">
			<textarea cols="90" rows="10">
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8" />
<title>2D transform_CSS参考手册_web前端开发参考手册系列</title>
<meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" />
<style>
h1{clear:both;padding-top:10px;font-size:16px;font-family:Arial;}
.test{zoom:1;width:700px;margin:0;padding:0;list-style:none;}
.test li{float:left;margin:20px 30px 0 0;border:1px solid #000;}
.test li p{width:300px;height:100px;margin:0;background:#ddd;}
.test .matrix{-moz-transform:matrix(0,1,1,1,10px,10px);-webkit-transform:matrix(0,1,1,1,10,10);-ms-transform:matrix(0,1,1,1,10,10);transform:matrix(0,1,1,1,10,10);}
.test .translate p{-moz-transform:translate(5%,10px);-webkit-transform:translate(10px,10px);-ms-transform:translate(10px,10px);transform:translate(10px,10px);}
.test .translate2 p{-moz-transform:translate(-10px,-10px);-webkit-transform:translate(-10px,-10px);-ms-transform:translate(-10px,-10px);transform:translate(-10px,-10px);}
.test .translateX p{-moz-transform:translateX(20px);-webkit-transform:translateX(20px);-ms-transform:translateX(20px);transform:translateX(20px);}
.test .translate3 p{-moz-transform:translate(20px);-webkit-transform:translate(20px);-ms-transform:translate(20px);transform:translate(20px);}
.test .translateY p{-moz-transform:translateY(10px);-webkit-transform:translateY(10px);-ms-transform:translateY(10px);transform:translateY(10px);}
.test .translate4 p{-moz-transform:translate(0,10px);-webkit-transform:translate(0,10px);-ms-transform:translate(0,10px);transform:translate(0,10px);}
.test .rotate{-moz-transform:rotate(-5deg);-webkit-transform:rotate(-5deg);-ms-transform:rotate(-5deg);transform:rotate(-5deg);}
.test .rotate2{-moz-transform:rotate(5deg);-webkit-transform:rotate(5deg);-ms-transform:rotate(5deg);transform:rotate(5deg);}
.test .scale{-moz-transform:scale(.8);-webkit-transform:scale(.8);-ms-transform:scale(.8);transform:scale(.8);}
.test .scale2{-moz-transform:scale(1.2);-webkit-transform:scale(1.2);-ms-transform:scale(1.2);transform:scale(1.2);}
.test .skew{-moz-transform:skew(-5deg);-webkit-transform:skew(-5deg);-ms-transform:skew(-5deg);transform:skew(-5deg);}
.test .skew2{-moz-transform:skew(-5deg,-5deg);-webkit-transform:skew(-5deg,-5deg);-ms-transform:skew(-5deg,-5deg);transform:skew(-5deg,-5deg);}
</style>
</head>
<body>
<h1>矩阵变换：matrix()</h1>
<ul class="test">
	<li class="matrix">
		<p>transform:matrix(0,1,1,1,10,10)</p>
	</li>
</ul>
<h1>平移：translate(), translateX(), translateY()</h1>
<ul class="test">
	<li class="translate">
		<p>transform:translate(5%,10px)</p>
	</li>
	<li class="translate2">
		<p>transform:translate(-10px,-10px)</p>
	</li>
	<li class="translateX">
		<p>transform:translateX(20px)</p>
	</li>
	<li class="translate3">
		<p>transform:translate(20px)</p>
	</li>
	<li class="translateY">
		<p>transform:translateY(10px)</p>
	</li>
	<li class="translate4">
		<p>transform:translate(0,10px)</p>
	</li>
</ul>
<h1>旋转：rotate()</h1>
<ul class="test">
	<li class="rotate">
		<p>transform:rotate(-15deg)</p>
	</li>
	<li class="rotate2">
		<p>transform:rotate(15deg)</p>
	</li>
</ul>
<h1>缩放：scale()</h1>
<ul class="test">
	<li class="scale">
		<p>transform:scale(.8)</p>
	</li>
	<li class="scale2">
		<p>transform:scale(1.2)</p>
	</li>
</ul>
<h1>扭曲：skew()</h1>
<ul class="test">
	<li class="skew">
		<p>transform:skew(-5deg)</p>
	</li>
	<li class="skew2">
		<p>transform:skew(-5deg,-5deg)</p>
	</li>
</ul>
</body>
</html>
			</textarea>
			<p><input type="button" value="运行" class="g-btn g-btn-sure" /></p>
		</div>
	</section>
</section>
<footer id="ft">
	<aside id="rights" class="g-mod">
		<!-- 插入浏览器及版权信息 -->
	</aside>
</footer>
<script src="../../js/jquery.js"></script>
<script src="../../js/inner.js"></script>
</body>
</html>